<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>新增陪玩个人信息</title>
    <base href="${pageContext.request.contextPath}/">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="/css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <script src="/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <!-- <link href="Content/Layui-KnifeZ/css/layui.css" rel="stylesheet"/> -->
    <script src="Content/Layui-KnifeZ/layui.js"></script>
    <script src="Content/ace/ace.js"></script>
</head>
<body>
<h2 style="margin: 0 auto">${act=="addSave"?"新建":"修改"}陪玩信息</h2>
<h2>${msg}</h2>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <form class="layui-form" action="servlet/ServiceAction?act=${act}" method="post" enctype="multipart/form-data">
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <span>*</span>
                        昵称
                    </label>
                    <div class="layui-input-block lafite_width_30">
                        <input name="id" type="hidden" value="${section.id}">
                        <input type="text" name="name" value="${section.name}" placeholder="${errors.get("name")}" class="layui-input">
                        <label style="color: red">${errors.get("name")}</label>
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">
                            <%--<span>*</span>--%>
                            星级
                        </label>
                        <div class="layui-input-block lafite_width_30">
                        <input name="level" type="text" value="${section.level_}" placeholder="1.0-5.0" class="layui-input" >
                         </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">
                            <span>*</span>
                            地区
                        </label>
                        <div class="layui-input-block lafite_width_30">
                            <input name="loc" type="text" value="${section.loc}" placeholder=""  class="layui-input" >
                            <label style="color: red">${errors.get("loc")}</label>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-inline">
                    <label class="layui-form-label">
                        接单量
                    </label>
                    <div class="layui-input-block lafite_width_30">
                    <input name="order_count" type="number" value="${section.order_count}" class="layui-input" >
                    </div>
                    </div>
                </div>

                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">
                        <%--<span>*</span>--%>
                        个人描述
                    </label>
                    <div class="layui-input-block lafite_width_60">
                        <textarea name="message" placeholder="请输入内容" class="layui-textarea lafite_textarea" value="${section.message}"></textarea>
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">
                            <span>*</span>
                            价格
                        </label>
                        <div class="layui-input-block lafite_width_30">
                            <input name="price" type="number" value="${section.price}" class="layui-input" >
                            <label style="color: red">${errors.get("price")}</label>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <span>*</span>
                        个人图片
                    </label>
                    <div class="layui-upload">
                        <input type="file" name="acc_img" value="${section.acc_img}"/>
                        <c:if test="${act!=addSave}">
                        <img src="${initParam.IP}${section.acc_img}">
                        </c:if>

                        <label style="color: red">${errors.get("acc_img")}</label>
                    </div>
                </div>


                <div class="layui-form-item layui-form-text">
                    <div class="layui-inline">
                    <label class="layui-form-label">
                        <%--<span>*</span>--%>
                        游戏
                    </label>
                        <div class="layui-input-block lafite_width_30">
                    <select name="game_name" class="layui-input" >
                        <c:forEach var="game" items="${games}">
                            <c:if test="${game.id == section.game_id.id}"><option selected>${game.title}</option></c:if>
                            <c:if test="${game.id != section.game_id.id}"><option>${game.title}</option></c:if>
                        </c:forEach>
                    </select>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">
                            <span>*</span>
                            段位
                        </label>
                        <div class="layui-input-block lafite_width_30">
                            <input name="dan" type="text" value="${section.dan}" class="layui-input" >
                            <label style="color: red">${errors.get("dan")}</label>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <input type="reset" class="lafite-layui-btn lafite_margin_left_20" />
                        <input type="submit" value="提交"  class="lafite-layui-btn2 lafite_margin_left_20px"/>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
<script>layui.use(['layedit', 'laydate', 'form', 'upload'],
    function() {
        var $ = layui.jquery
            ,upload = layui.upload,
            layedit = layui.layedit;
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });

        //日期时间范围
        laydate.render({
            elem: '#test10'
            ,type: 'datetime'
            ,range: true
        });

        //日期时间范围
        laydate.render({
            elem: '#test11'
            ,type: 'datetime'
            ,range: true
        });

        //多图片上传
        upload.render({
            elem: '#lafite_upload'
            ,url: '/upload/'
            ,multiple: true
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#demo2').append('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
                });
            }
            ,done: function(res){
                //上传完毕
            }
        });

        layedit.set({
            //暴露layupload参数设置接口 --详细查看layupload参数说明
            uploadImage: {
                url: 'your url',
                accept: 'image',
                acceptMime: 'image/*',
                exts: 'jpg|png|gif|bmp|jpeg',
                size: 1024 * 10,
                done: function (data) {
                    console.log(data);
                }
            }
            , uploadVideo: {
                url: 'your url',
                accept: 'video',
                acceptMime: 'video/*',
                exts: 'mp4|flv|avi|rm|rmvb',
                size: 1024 * 10 * 2,
                done: function (data) {
                    console.log(data);
                }
            }
            , uploadFiles: {
                url: 'your url',
                accept: 'file',
                acceptMime: 'file/*',
                size: '20480',
                done: function (data) {
                    console.log(data);
                }
            }
            //右键删除图片/视频时的回调参数，post到后台删除服务器文件等操作，
            //传递参数：
            //图片： imgpath --图片路径
            //视频： filepath --视频路径 imgpath --封面路径
            , calldel: {
                url: 'your url',
                done: function (data) {
                    console.log(data);
                }
            }
            //开发者模式 --默认为false
            , devmode: true
            //插入代码设置 --hide:true 等同于不配置codeConfig
            , codeConfig: {
                hide: false,  //是否显示编码语言选择框
                default: 'javascript' //hide为true时的默认语言格式
            }
            //新增iframe外置样式和js
            // , quote:{
            //    style: ['/Content/Layui-KnifeZ/css/layui.css','/others'],
            //    js: ['/Content/Layui-KnifeZ/lay/modules/jquery.js']
            // }
            //自定义样式-暂只支持video添加
            //, customTheme: {
            //    video: {
            //        title: ['原版', 'custom_1', 'custom_2']
            //        , content: ['', 'theme1', 'theme2']
            //        , preview: ['', '/images/prive.jpg', '/images/prive2.jpg']
            //    }
            //}
            //插入自定义链接
            , customlink:{
                title: '插入layui官网'
                , href: 'https://www.layui.com'
                ,onmouseup:''
            }
            , facePath: 'http://knifez.gitee.io/kz.layedit/Content/Layui-KnifeZ/'
            , devmode: true
            , videoAttr: ' preload="none" '
            , tool: [
                'html', 'undo', 'redo', 'code', 'strong', 'italic', 'underline', 'del', 'addhr', '|', 'fontFomatt', 'fontfamily','fontSize', 'fontBackColor', 'colorpicker', 'face'
                , '|', 'left', 'center', 'right', '|', 'link', 'unlink', 'images', 'image_alt', 'video','attachment', 'anchors'
                , '|'
                , 'table','customlink'
                , 'fullScreen'
            ]
            , height: '300px'
        });
        var ieditor = layedit.build('layeditDemo');
        //设置编辑器内容
        layedit.setContent(ieditor, "<h1>请编辑资讯内容</h1>", false);



    });


</script>

</html>
